﻿using System;
using System.Windows.Forms;

namespace WOLGateway.ClientGUI
{
    /// <summary>
    /// Program
    /// </summary>
    internal static class Program
    {
        private static WakeOnLanForm wakeOnLanForm;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        /// <param name="args">Arguments</param>
        [STAThread]
        public static void Main(string[] args)
        {
            string macAddress = null;
            if (args.Length > 0)
            {
                macAddress = args[0];
            }

            string wolGatewayServiceUrl = null;
            if (args.Length > 1)
            {
                wolGatewayServiceUrl = args[1];
            }

            if (args.Length > 2)
            {
                MessageBox.Show(@"Invalid number of command line arguments." + Environment.NewLine + Environment.NewLine
                    + "Usage: WOLGateway.ClientGUI.exe {MACAddress}" + Environment.NewLine
                    + "i.e. WOLGateway.ClientGUI.exe 00-00-00-00-00-01" + Environment.NewLine + Environment.NewLine
                    + "Or: WOLGateway.ClientGUI.exe {MACAddress} {ServiceURL}" + Environment.NewLine
                    + "i.e. WOLGateway.ClientGUI.exe 00-00-00-00-00-01 http://servername/WOL/service.svc" + Environment.NewLine + Environment.NewLine);
                Environment.Exit(-1);
            }
            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            wakeOnLanForm = new WakeOnLanForm(macAddress, wolGatewayServiceUrl);
            Application.Run(wakeOnLanForm);
        }
    }
}
